package operation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: wenxiwen
 * Date: 2022/4/13
 * Time: 17:27
 * Description: No Description
 */
public class Add implements IOperation{

    public void work(BookList booklist) {
        System.out.println("新增图书");
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入书名：");
        String name = scan.nextLine();
        System.out.println("请输入作者");
        String author = scan.nextLine();
        System.out.println("请输入书的类型：");
        String type = scan.nextLine();
        System.out.println("请输入书的价格：");
        int price = scan.nextInt();

        Book book = new Book(name,author,price,type);

        int index = booklist.getCount();
        booklist.setBook(index,book);
        booklist.setCount(index+1);

        System.out.println("新增成功！！");
    }
}